﻿#ifndef MEASUREPARALLELLINE_H
#define MEASUREPARALLELLINE_H

#include "MeasureElement.h"
namespace Qly {

class MeasureDataSet;

/**
 * @brief The MeasureParallelLine class 平行线间的距离
 *                           m_results_um[0] 存的是平行线间的距离。
 */
class MeasureParallelLine: public MeasureElement
{
    friend MeasureDataSet;
public:
    MeasureParallelLine(MeasureDataSet *parent = nullptr);
    QString name() Q_DECL_OVERRIDE {return u8"平行线间距离";}

private:
    void computeLengthSlope( void );
    void setSecondLine(QPointF point_pix, QPointF point_um);
    QPointF endPoint(QPointF lineS, QPointF lineE, QPointF p);// 计算点到直线的垂足
    int mouseLButtonPress(QPointF point_pix, QPointF point_um) Q_DECL_OVERRIDE;
    int mouseMove(QPointF point_pix, QPointF point_um) Q_DECL_OVERRIDE;
    void compute(void) Q_DECL_OVERRIDE; //计算图元的位置，还有长度结果
    void updateText(bool updatePosition = true) Q_DECL_OVERRIDE;
    void paint( QPainter &painter ) Q_DECL_OVERRIDE; //画方法
    double m_cos_theta;
    double m_sin_theta;
    double m_angle;
    double m_length_pix;
    double m_length_um;
};
}

#endif // MEASUREPARALLELLINE_H
